﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using LaunchMeNot.Core;
using NUnit.Framework;

namespace LaunchMeNot.Tests.Core
{
    [TestFixture]
    public class BllTests
    {
        [TestCase("C:\\Myapp\\myapp.exe", Result=new[] {"C:\\Myapp\\myapp.exe", null})]
        [TestCase("C:\\Myapp\\myapp.exe blah", Result=new[] {"C:\\Myapp\\myapp.exe", "blah"})]
        [TestCase("\\\\server\\Myapp\\myapp.exe blah", Result=new[] {"\\\\server\\Myapp\\myapp.exe", "blah"})]
        [TestCase("\\\\10.0.0.1\\Myapp\\myapp.exe blah", Result=new[] {"\\\\10.0.0.1\\Myapp\\myapp.exe", "blah"})]
        [TestCase("%windir%\\10.0.0.1\\Myapp\\myapp.exe blah", Result=new[] {"%windir%\\10.0.0.1\\Myapp\\myapp.exe", "blah"})]
        [TestCase("C:\\Myapp\\myapp.exe -blah -foo", Result=new[] {"C:\\Myapp\\myapp.exe", "-blah -foo"})]
        [TestCase("\"C:\\My big apps\\myapp.exe\"", Result=new[] {"\"C:\\My big apps\\myapp.exe\"", null})]
        [TestCase("\"C:\\My big apps\\myapp.exe\" -blah", Result=new[] {"\"C:\\My big apps\\myapp.exe\"", "-blah"})]
        [TestCase("\"C:\\My big apps\\myapp.exe\" -blah -foo", Result=new[] {"\"C:\\My big apps\\myapp.exe\"", "-blah -foo"})]
        public object TestArgumentExtraction(string path) {
            var pair = Utils.SplitArguments(path);

            return new[] { pair.Key, pair.Value };
        }
    }
}
